package cn.aopmin.controller

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime
import javax.servlet.http.HttpServletRequest

/**
 * Kotlin Controller
 * @author aopmin
 * @since 2024-12-30
 */
@RestController
class HelloController {

    @GetMapping("/hello")
    fun hello(@RequestParam("name") name: String, request: HttpServletRequest): String {
        //获取ip地址
        val ip = request.remoteAddr
        println("拦截ip: $ip")
        return "Hello, " + name + "🤪"
    }
}